#!/usr/bin/python
import os
import sys
from subprocess import Popen, PIPE
var = "ls -l tt"
p = Popen(var , shell=True, stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
#print "Return code: ", p.returncode
print out.rstrip(), err.rstrip()
